using System;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

namespace NNFramework.NeuroLibrary
{
    [Serializable]
    public class clsBase
    {
        #region Const Section

        public const string STR_DFT_TBLEXMNAM = "NetworkExamples";
        public const string STR_DFT_NS = "http://www.artint.org";

        #endregion

        #region Serialization Methods Section

        public void SerializeMeToXml(string pstrFileName)
        {
            XmlSerializer xslSerializer = new XmlSerializer(GetType());
            StreamWriter swtWriter = new StreamWriter(pstrFileName);
            xslSerializer.Serialize(swtWriter, this);
            swtWriter.Close();
        }

        public void SerializeMeToBin(string pstrFileName)
        {
            IFormatter iftBinary = new BinaryFormatter();
            Stream stmFile = new FileStream(pstrFileName, FileMode.Create, FileAccess.Write, FileShare.None);
            iftBinary.Serialize(stmFile, this);
            stmFile.Close();
        }

        #endregion
    }
}
